<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex grainDetails_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub grainDetails_fd0_0'>
          <view class='flex flex-wrap align-center grainDetails_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  grainDetails_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='grainDetails_fd0_0_c1_c0'>粮站地图</text>
          </view>
          <view class='flex flex-wrap align-center justify-end grainDetails_fd0_0_c0'>
            <image class='grainDetails_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"7.png"'></image>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout grainDetails_flex_1">
        <view class='flex flex-direction flex-wrap align-stretch grainDetails_fd1_0'>
          <view class='flex flex-wrap align-center'>
            <image class='grainDetails_fd1_0_c0_c0' mode="aspectFill" :src='info.zhaopaifengmian'></image>
            <view class='flex flex-direction flex-wrap align-stretch flex-sub'>
              <text class='grainDetails_fd1_0_c0_c1_c0'>{{info.mingcheng}}</text>
              <text class='grainDetails_fd1_0_c0_c1_c1'>{{info.chengshi}}</text>
              <view class='flex flex-wrap align-center grainDetails_fd1_0_c0_c1_c2'>
                <text class='grainDetails_fd1_0_c0_c1_c2_c0'>经营</text>
                <text class='grainDetails_fd1_0_c0_c1_c2_c0'>{{info.jingyingnianxian}}年</text>
                <text class='grainDetails_fd1_0_c0_c1_c2_c0'>丨距您</text>
                <text class='grainDetails_fd1_0_c0_c1_c2_c3'>{{info.distance || 0}}</text>
              </view>
              <view class='align-center grainDetails_fd1_0_c0_c1_c3'>

                <view>
                  <text class='grainDetails_fd1_0_c0_c1_c3_c0'>{{info.liangzhancate_mingcheng}} </text>
                </view>
                <view class="flex flex-wrap">
                  <view class='flex align-center grainDetails_fd1_0_c0_c1_c3_c1'
                    v-for="(item,index) in info.liangzhanshebeicate_mingcheng" :key="index">
                    <text class='grainDetails_fd1_0_c0_c1_c3_c1_c0'>{{item}}</text>
                  </view>
                  <!--        <view class='flex flex-wrap align-center grainDetails_fd1_0_c0_c1_c3_c1'
                    v-if="info.liangzhan_cate_pid4_text">
                    <text class='grainDetails_fd1_0_c0_c1_c3_c1_c0'>{{info.liangzhan_cate_pid4_text}}</text>
                  </view>
                  <view class='flex flex-wrap align-center grainDetails_fd1_0_c0_c1_c3_c1'
                    v-if="info.liangzhan_cate_pid5_text">
                    <text class='grainDetails_fd1_0_c0_c1_c3_c1_c0'>{{info.liangzhan_cate_pid5_text}}</text>
                  </view>
                  <view class='flex flex-wrap align-center grainDetails_fd1_0_c0_c1_c3_c1'
                    v-if="info.liangzhan_cate_pid6_text">
                    <text class='grainDetails_fd1_0_c0_c1_c3_c1_c0'>{{info.liangzhan_cate_pid6_text}}</text>
                  </view> -->
                </view>
                <view class="margin-top-sm">
                  <text class='grainDetails_fd1_0_c0_c1_c3_c0'>{{info.liagnzhanothercate_mingcheng}} </text>
                </view>
              </view>
              <view class='flex flex-wrap align-center grainDetails_fd1_0_c0_c1_c4'>
                <view class="flex flex-wrap align-center " v-if="info.certified==2">
                  <image class='grainDetails_fd1_0_c0_c1_c4_c0' mode="aspectFit" :src='STATIC_URL+"5.png"'></image>
                  <text class='grainDetails_fd1_0_c0_c1_c4_c1'>已实名认证</text>
                </view>
                <view class="flex flex-wrap align-center" v-if="info.is_vip">
                  <image class='grainDetails_fd1_0_c0_c1_c4_c2' mode="aspectFit" :src='STATIC_URL+"5.png"'></image>
                  <text class='grainDetails_fd1_0_c0_c1_c4_c1'>VIP会员</text>
                </view>

              </view>
            </view>
          </view>
          <view class='flex flex-wrap align-center justify-between grainDetails_fd1_0_c1'>
            <view class='flex flex-wrap align-center justify-center grainDetails_fd1_0_c1_c0'
              @click.stop="goMap(info.weidu,info.jingdu)">
              <image class='grainDetails_fd1_0_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
              <image class='grainDetails_fd1_0_c1_c0_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
              <text class='grainDetails_fd1_0_c1_c0_c2'>一键导航</text>
            </view>
            <view class='flex flex-wrap align-center justify-center grainDetails_fd1_0_c1_c1'
              @click.stop="callPhone(info)">
              <image class='grainDetails_fd1_0_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
              <image class='grainDetails_fd1_0_c1_c0_c1' mode="aspectFit" :src='STATIC_URL+"64.png"'></image>
              <text class='grainDetails_fd1_0_c1_c0_c2'>立即联系</text>
            </view>
          </view>
        </view>
        <view class='flex flex-direction flex-wrap align-stretch grainDetails_fd1_1'>
          <view class='flex flex-wrap align-center'>
            <view class='flex flex-wrap align-center grainDetails_fd1_1_c0_c0'>
            </view>
            <text class='grainDetails_fd1_1_c0_c1'>粮站展示：</text>
          </view>
          <view class='flex flex-wrap align-center'>
            <image class='grainDetails_fd1_1_c1_c0' @click="prevImage(liangzhanhuanjing,index)"
              v-for="(item,index) in liangzhanhuanjing" :key="index" mode="aspectFill" :src='item'></image>

          </view>
        </view>
        <view class='flex flex-wrap align-center justify-between grainDetails_fd1_2'>
          <view class='flex flex-wrap align-center justify-center grainDetails_fd1_0_c1_c0'
            @click.stop="goMap(info.weidu,info.jingdu)">
            <image class='grainDetails_fd1_0_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
            <image class='grainDetails_fd1_0_c1_c0_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
            <text class='grainDetails_fd1_0_c1_c0_c2'>一键导航</text>
          </view>
          <view class='flex flex-wrap align-center justify-center grainDetails_fd1_0_c1_c1'
            @click.stop="callPhone(info)">
            <image class='grainDetails_fd1_0_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
            <image class='grainDetails_fd1_0_c1_c0_c1' mode="aspectFit" :src='STATIC_URL+"64.png"'></image>
            <text class='grainDetails_fd1_0_c1_c0_c2'>立即联系</text>
          </view>
        </view>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  export default {
    components: {},


    data() {
      return {
        "aid": "",
        liangzhanhuanjing: [],
        info: '',
        address: {
          latitude: '',
          longitude: '',
          city: ''
        }
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        aid
      } = options
      if (aid !== undefined) this.aid = aid

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      let that = this
      if (uni.getStorageSync('address')) {
        this.address = uni.getStorageSync('address')
        console.log('iiii', this.address)
      } else {
        uni.getLocation({
          type: 'gcj02',
          // #ifdef APP
          geocode: true,
          // #endif
          isHighAccuracy: true,
          success: adr => {
            console.log('adradradradr', adr)
            const obj = {
              latitude: adr.latitude,
              longitude: adr.longitude,
              city: adr.address.city
            }
            uni.setStorageSync('address', obj)
            that.address = uni.getStorageSync('address')
          }
        })
      }
      this.getDetail()
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      callPhone(item) {
        if (this.info.is_vip) {
          this.callMobile(item.lianxidianhua)
        } else {
          this.$urouter.navigateTo(`/pages/wode/rurchaseMembership/rurchaseMembership`);
        }
      },
      goMap(lat, lng) {
        console.log('success')
        if (this.info.is_vip) {
          uni.openLocation({
            latitude: parseFloat(lat),
            longitude: parseFloat(lng),
            name: this.info.weizhi,
            success() {
              console.log('success')
            }
          })
        } else {
          this.$urouter.navigateTo(`/pages/wode/rurchaseMembership/rurchaseMembership`);
        }

      },
      getDetail() {
        console.log('iiii', this.address)
        this.$api.post(global.apiUrls.post65d84a4c2a9f6, {
          aid: this.aid,
          lat: this.address.latitude,
          lng: this.address.longitude
        }).then(res => {
          if (res.data.code == 1) {
            this.info = res.data.data
            this.liangzhanhuanjing = this.info.liangzhanhuanjing
            this.info.zhaopaifengmian = this.info.zhaopaifengmian[0]
          }
        })
      },
      prevImage(list, index) {
        uni.previewImage({
          urls: list,
          current: index
        })
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .grainDetails_flex_0 {
    background: rgba(255, 255, 255, 1);
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto;
  }

  .grainDetails_fd0_0_c2_c0 {
    width: 119rpx;
    height: 55rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .grainDetails_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .grainDetails_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .grainDetails_fd0_0_c0 {
    width: 120rpx;
  }

  .grainDetails_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .grainDetails_flex_1 {
    padding: 24rpx 30rpx 0rpx 30rpx;
  }

  .grainDetails_fd1_2 {
    margin: 0rpx 0rpx 40rpx 0rpx;
  }

  .grainDetails_fd1_1_c1_c0 {
    width: 650rpx;
    height: 427rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_1_c0_c1 {
    color: #101010;
    font-size: 34rpx;
    font-weight: 700;
    line-height: 42rpx;
    margin: 0rpx 0rpx 0rpx 16rpx;
  }

  .grainDetails_fd1_1_c0_c0 {
    background: rgba(37, 104, 174, 1);
    border-radius: 4rpx;
    width: 6rpx;
    height: 30rpx;
    background-size: 100% auto;
  }

  .grainDetails_fd1_1 {
    background: rgba(255, 255, 255, 1);
    border-radius: 16rpx;
    background-size: 100% auto;
    margin: 0rpx 0rpx 40rpx 0rpx;
    padding: 30rpx 20rpx 30rpx 20rpx;
  }

  .grainDetails_fd1_0_c1_c1 {
    background: linear-gradient(90deg, #FBEBCC 0%, #F8D48F 100%);
    width: 300rpx;
    height: 80rpx;
    border-radius: 24rpx;
    background-size: 100% auto;
    position: relative;
  }

  .grainDetails_fd1_0_c1_c0_c2 {
    color: #624314;
    font-size: 32rpx;
    font-weight: 700;
    line-height: 32rpx;
  }

  .grainDetails_fd1_0_c1_c0_c1 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 11rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_0_c1_c0_c0 {
    width: 72rpx;
    height: 29rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    position: absolute;
    top: 0rpx;
    left: 0rpx;
    z-index: 1;
  }

  .grainDetails_fd1_0_c1_c0 {
    background: linear-gradient(90deg, #F3E0C7 0%, #F2C49D 100%);
    width: 300rpx;
    height: 80rpx;
    border-radius: 24rpx;
    background-size: 100% auto;
    position: relative;
  }

  .grainDetails_fd1_0_c1 {
    margin: 40rpx 0rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_0_c0_c1_c4_c2 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 16rpx 0rpx 34rpx;
  }

  .grainDetails_fd1_0_c0_c1_c4_c1 {
    color: #C86105;
    font-size: 26rpx;
    font-weight: 400;
    line-height: 26rpx;
  }

  .grainDetails_fd1_0_c0_c1_c4_c0 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_0_c0_c1_c4 {
    margin: 17rpx 0rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_0_c0_c1_c3_c1_c0 {
    color: #667D91;
    font-size: 24rpx;
    font-weight: 500;
    line-height: 24rpx;
  }

  .grainDetails_fd1_0_c0_c1_c3_c1 {
    background: rgba(244, 247, 255, 1);
    margin: 24rpx 24rpx 0rpx 0rpx;
    padding: 4rpx 14rpx 4rpx 14rpx;
    border-radius: 4rpx;
    // width: 110rpx;
  }

  .grainDetails_fd1_0_c0_c1_c3_c0 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .grainDetails_fd1_0_c0_c1_c3 {
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_0_c0_c1_c2_c3 {
    color: #2568AE;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .grainDetails_fd1_0_c0_c1_c2_c0 {
    color: rgba(153, 153, 153, 1);
    font-size: 24rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .grainDetails_fd1_0_c0_c1_c2 {
    margin: 10rpx 0rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_0_c0_c1_c1 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 28rpx;
    margin: 14rpx 0rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_0_c0_c1_c0 {
    color: #101010;
    font-size: 34rpx;
    font-weight: 500;
    line-height: 34rpx;
  }

  .grainDetails_fd1_0_c0_c0 {
    width: 220rpx;
    height: 266rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 24rpx 0rpx 0rpx;
  }

  .grainDetails_fd1_0 {
    background: rgba(255, 255, 255, 1);
    margin: 0rpx 0rpx 24rpx 0rpx;
    background-size: 100% auto;
    border-radius: 16rpx;
    padding: 32rpx 24rpx 40rpx 24rpx;
  }
</style>
